package whf.file.service;

import java.util.List;

import whf.file.dao.TypeDAO;
import whf.file.entity.Type;
import whf.framework.exception.FindException;
import whf.framework.exception.ServiceNotFoundException;
import whf.framework.util.BeanFactory;

/**
 * 服务对象具体实现，委托相应的dao对象实现相关操作
 * 
 * @author wanghaifeng
 * @email king@126.com
 * @modify 2006-11-14
 */
@SuppressWarnings(value={"unchecked"})
public class TypeServiceImp extends whf.framework.service.ServiceImp<Type> implements
		TypeService {

	private TypeDAO typeDAO;

	public void setTypeDAO(TypeDAO typeDAO) {
		this.typeDAO = typeDAO;
	}

	public static TypeService getTypeService() throws ServiceNotFoundException {
		return (TypeService) BeanFactory.getService(TypeServiceImp.class);
	}

	/* (non-Javadoc)
	 * @see whf.file.service.TypeService#findByExt(java.lang.String)
	 */
	public Type findByExt(String ext) throws FindException {
		List list = super.find("t.ext=?", ext);
		if(list.size() > 0){
			return (Type)list.get(0);
		} else {
			return null;
		}
	}

}